<template>
	<view>
		<view class="row">
			<view class="carrier">
				<view class="left">
					<image class="image" :src="info.ProductImage"></image>
				</view>
				<view class="mid">
					<view class="title in2line">{{info.ProductName}}</view>
					<view class="data" style="height: 20rpx;"></view>
					<view class="bottom">
						<text class="price text-rf">￥{{info.SinglePrice || ''}}</text>
						<text>x{{info.Quantity || ''}}</text>
					</view>
				</view>
			</view>
		</view>
		
		<view class="form">
			<view class="form-list">
				<view class="form-list-title">退货信息</view>
				
				<view class="form-item">
					<view class="form-item-label">快递名称<text>*</text></view>
					<view class="input upload">
						<input type="text" placeholder="请输入快递名称" placeholder-class="ac" v-model="form.name">
					</view>
				</view>
				<view class="form-item">
					<view class="form-item-label">快递单号<text>*</text></view>
					<view class="input upload">
						<input type="text" placeholder="请输入快递单号" placeholder-class="ac" v-model="form.odd">
					</view>
				</view>
			</view>
		</view>
		<button class="confirm-btn bg-rf" formType="submit" @click="submit()">
			提交
		</button>
	</view>
</template>

<script>
	import {goodsEnterReturnLogistics} from '@/common/http/api.js'
	export default {
		data(){
			return {
				info: '',
				form:{
					id: '',
					name: '',
					odd: ''
				}
			}
		},
		onLoad(e) {
			this.form.id = e.id
			this.info = uni.getStorageSync('refundOrder')
		},
		methods:{
			submit(e){
				if(this.form.name === '') {
					uni.showToast({duration:3000,
						title: "请输入快递名称！",
						icon: 'none'
					})
					return
				}
				if(this.form.odd === '') {
					uni.showToast({duration:3000,
						title: "请输入快递单号！",
						icon: 'none'
					})
					return
				}
				let data = {
					...this.form
				}
				uni.showLoading()
				goodsEnterReturnLogistics(data).then(res=>{
					uni.hideLoading()
					uni.showToast({duration:3000,
						title: "提交成功！",
						icon: 'none'
					})
					setTimeout(()=>{
						uni.navigateBack()
					},1500)
					
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #f8f8f8;
	}
	
	
	.text-rf {
		color: #fa436a;
	}
	
	.bg-rf {
		background-color: #fa436a;
		color: #ffffff;
	}
	
	
	.confirm-btn {
		width: 630upx;
		height: 76upx;
		line-height: 76upx;
		border-radius: 50px;
		margin-top: 50upx;
		font-size: $font-lg;
	
		&:after {
			border-radius: 100px;
		}
	}
	
	.row {
		margin: 0 auto $spacing-lg;
		width: 690rpx;
		height: calc(22vw + 40upx);
		border-radius: 20rpx;
		// box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.1);
		margin: 30rpx auto;
		margin-top: 30rpx;
		display: flex;
		align-items: center;
		position: relative;
		overflow: hidden;
		z-index: 4;
		border: 0;
	
		.carrier {
			@keyframes showMenu {
				0% {
					transform: translateX(0);
				}
	
				100% {
					transform: translateX(-30%);
				}
			}
	
			@keyframes closeMenu {
				0% {
					transform: translateX(-30%);
				}
	
				100% {
					transform: translateX(0);
				}
			}
	
			&.open {
				animation: showMenu 0.25s linear both;
			}
	
			&.close {
				animation: closeMenu 0.15s linear both;
			}
	
			background-color: #fff;
			position: absolute;
			width: 100%;
			padding: 0 0;
			height: 100%;
			z-index: 3;
			display: flex;
			align-items: center;
	
			.left {
				width: 22vw;
				height: 22vw;
				margin-left: 20upx;
				margin-right: 10upx;
	
				.image {
					border-radius: 10upx;
					width: 22vw;
					height: 22vw;
				}
			}
	
			.mid {
				text-align: left;
				width: 100%;
				margin: 10upx 10upx 0;
	
				.title {
					color: $font-color-dark;
					height: 60upx;
					line-height: 1.2;
					font-size: $font-base;
				}
	
				.data {
					width: 100%;
					display: flex;
					align-items: center;
					margin: 10upx 0 5upx;
					font-size: $font-base;
					color: $font-color-base;
	
					.item {
						flex: 1;
					}
	
					.iconfont {
						color: $font-color-light;
						margin-right: 10upx;
					}
	
					.status {
						padding: 6upx 20upx;
						background-color: $base-color;
						opacity: 0.8;
						color: $color-white;
						font-size: $font-sm;
						border-radius: 6upx;
					}
				}
	
				.bottom {
					line-height: 1.2;
					width: 100%;
					display: flex;
					justify-content: space-between;
					padding-right: 30rpx;
					box-sizing: border-box;
					align-items: center;
					font-size: $font-sm;
					color: $font-color-light;
	
					.price {
						font-size: $font-lg;
					}
	
					text {
						font-size: 28rpx;
					}
				}
			}
	
			.data {
				color: $font-color-light;
			}
		}
	}
	.form {
		width: 690rpx;
		margin: 0 auto;
	
		.form-list {
			width: 100%;
			box-sizing: border-box;
			padding: 30rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			margin-bottom: 24rpx;
	
			.form-list-title {
				padding-bottom: 30rpx;
				border-bottom: 1rpx solid #EEEEEE;
			}
	
			.form-item {
				width: 100%;
				display: flex;
				align-items: center;
				padding: 30rpx 0;
	
				.form-item-label {
					width: 176rpx;
	
					text {
						color: red;
					}
				}
	
				.input {
					flex: 1;
					min-width: 0;
					display: flex;
					align-items: center;
					justify-content: space-between;
	
					.input-tx {
						font-family: PingFang SC;
						font-weight: 300;
						font-size: 28rpx;
						color: #999999;
						flex: 1;
						min-width: 0;
						margin-right: 30rpx;
					}
	
					input {
						font-family: PingFang SC;
						font-weight: 300;
						font-size: 28rpx;
						color: #999999;
						flex: 1;
						min-width: 0;
						margin-right: 30rpx;
					}
	
					.ac {
						font-family: PingFang SC;
						font-weight: 300;
						font-size: 28rpx;
						color: #999999;
					}
	
					image {
						width: 11rpx;
						height: 22rpx;
					}
				}
	
				.upload {
					.upload-item {
						width: 100%;
						display: flex;
						align-items: center;
	
						image {
							width: 88rpx;
							height: 88rpx;
							margin-right: 40rpx;
						}
	
						text {
							font-family: PingFang SC;
							font-weight: 400;
							font-size: 26rpx;
							color: #23B97F;
						}
					}
				}
	
				.tx-r {
					.input-tx {
						text-align: right;
					}
				}
	
				.select {
					.input-tx {
						text-align: left;
					}
				}
			}
	
			.form-item:last-child {
				padding-bottom: 0;
			}
	
			.form-list-add {
				height: 170rpx;
				display: flex;
				align-items: center;
				justify-content: center;
	
				image {
					width: 28rpx;
					margin-right: 20rpx;
					height: 28rpx;
				}
	
				font-family: PingFang SC;
				font-weight: 300;
				font-size: 24rpx;
				color: #23B97F;
			}
		}
	}
	
	
</style>